﻿using Ping.Core;

namespace Ping.App
{
	public sealed class StateService
		: StorageService<State>
	{
		/// <summary>
		/// The current state of the application.
		/// For the entire tombstoning, killing etc.. shit
		/// There can be only one...
		/// </summary>
		public static State State;

		protected override string FileName
		{
			get { return "State.xml"; }
		}

		protected override State CreateDefault()
		{
			return new State();
		}

		public static void Store()
		{
			var tmp = new StateService();
			tmp.Save(State);
		}

		public static void Restore()
		{
			var tmp = new StateService();
			State = tmp.Load();
			State.Init();
		}
	}
}